from fastapi import FastAPI
from services.api import setting_api, chat_api
from fastapi.middleware.cors import CORSMiddleware
import uvicorn

app = FastAPI()

# 允许所有来源的跨域请求
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # 允许所有来源
    allow_credentials=True,
    allow_methods=["*"],   # 允许所有HTTP方法
    allow_headers=["*"]    # 允许所有请求头
)

app.post(path='/agent-setting', description="智能体设置")(setting_api)
app.post(path='/agent-chat', description="智能体聊天")(chat_api)


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8503, reload=False)